<template>
  <modal :visible="showDialog" position="center">
    <view class="container">
      <view class="close" @click="closeDialog"></view>
     
      <view class="checkBtnBox">
        <view class="btn-new" @click="skipWishList"></view>
      </view>
    </view>
  </modal>
</template>

<script>
  import modal from "@/components/modal/modal.vue";
  import api from '@/api/api';
  export default {
    data() {
      return {
        showDialog: false,
        listObj: {}
      }
    },
    props: {
      from: {
        type: String
      }
    },
    mounted() {},
    methods: {

      async open(item) {
        this.showDialog = true
        if (!!item) {
          this.listObj = item
        }
        this.$commonSensors.popupEvent('PopupExposure', {'popup_type' : '意向登记', 'popup_name': '心愿单添加成功弹窗'})
      },
      closeDialog() {
        this.showDialog = false
        this.$commonSensors.popupEvent('PopupClick', {'popup_type' : '意向登记', 'popup_name': '心愿单添加成功弹窗', 'button_name': '关闭'})
      },
      skipWishList() {
        this.showDialog = false
        if (this.from == 'list') {
          getApp().commonClTrack('c_ebmp_wish_list_view_wish_list', {
            c_link_pagename: '我的心愿单',
            c_link_path: 'pages/customer/wishList',
            c_product_name: this.listObj.itemName,
            c_product_brand: 'THE MACALLAN',
            c_product_price: this.listObj.price,
            c_product_volume: this.listObj.valueName,
            c_product_id: this.listObj.itemId,
            c_purchase_type:  '',
          })
          this.$emit('changeComponent')
        } else {
          this.$parent.commonTrack('c_ebmp_wish_list_view_wish_list', {
            c_link_pagename: '我的心愿单',
            c_link_path: 'pages/customer/wishList'
          })
          uni.navigateTo({
            url: '/pages/customer/wishList'
          })
        }
        this.$commonSensors.popupEvent('PopupClick', {'popup_type' : '意向登记', 'popup_name': '心愿单添加成功弹窗', 'button_name': '查看心愿单'})
      }
    }
  }
</script>

<style lang="scss">
  .container {
    width: 654rpx;
    height: 672rpx;
    background: #fff;
	background-image: url('https://100000063-1252208446.file.myqcloud.com/images/macallan-remvp/pdp/fav_modal.png');
	background-size:100%;
	background-position: 0 0;
	background-repeat: no-repeat;

    .close {
      position: absolute;
      width: 85rpx;
      height: 850rpx;
      top: 8rpx;
      right: 10rpx;
      line-height: 40rpx;
      font-size: 44rpx;
      text-align: center;
    }

    .text {
      font-size: 28rpx;
      line-height: 44rpx;
      margin-top: 80rpx;
      margin: 80rpx 55rpx 52rpx;
      text-align: justify;
      color: #1A1A1A;

      .main-text {
        text-align: center;
        font-size: 40rpx;
        margin-bottom: 52rpx;
      }
    }

    .checkBtnBox {
		position: absolute;
		width: 100%;
		bottom:96rpx;
		left:0;
      display: flex;
      justify-content: center;

      .btn-new {
       width: 526rpx;
       height: 80rpx;
        line-height: normal;
        display: flex;
        align-items: center;
        justify-content: center;
    
      }
    }
  }
</style>
